#include<iostream>
#include<vector>
using namespace std;
int main()
{
	vector<int> v1 = { 7,4,1,5,6,2,8,9,10 };
	int tmp = v1[0];
	int tmpi = 0;
	int left = 0, right = v1.size() - 1;
	while (left < right)
	{
		while (left<right)
		{
			if (v1[right] <tmp)
				break;
			right--;
		}
		while (left<right)
		{
			if (v1[left] > tmp)
				break;
			left++;
		}
		swap(v1[right], v1[left]);
	}
	swap(v1[left], v1[tmpi]);
	vector<int>::iterator lt = v1.begin();
	while (lt != v1.end())
	{
		cout << *lt <<' ';
		lt++;
	}
	return 0;
}